<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>$sce服务安全处理html数据</title>
		<script src="../org/angular.min.js"></script>
		<script src="../org/jquery.min.js" ></script>
	</head>
	<body>
		<div ng-app="hd" >
			<div ng-controller="ctrl1">
				{{data}}
			</div>
			<div ng-controller="ctrl2">
				{{data}}
			</div>
		</div>
		<script>
			var m = angular.module('hd',[]);
			
			m.controller('ctrl1',['$scope','$cacheFactory',function($scope,$cacheFactory){
				var obj = $cacheFactory('mytable');
				obj.put('web',{name:"renren",url:"www.baidu.com"});
				obj.put('mobile',{name:"人人",url:"www.taobao.com"});
				$scope.data = obj.get('web').name;
//				obj.remove('web');   //删除一条数据
//				obj.removeAll();  //删除所有数据
//				obj.destroy();  //直接删除表mytable（继续打印会出错）
//				$scope.data = obj.get('web');
			}]);
			m.controller('ctrl2',['$scope','$cacheFactory',function($scope,$cacheFactory){
				var obj = $cacheFactory.get('mytable');
				$scope.data = obj.get('web').name;
			}]);
		</script>
	</body>
</html>

